Skip to content

refactor: use define for evo-card#460

Merged
LuLaValva merged 2 commits intomainfrom
evo-card-refactor
Feb 5, 2026
Merged

refactor: use define for evo-card#460
LuLaValva merged 2 commits intomainfrom
evo-card-refactor

Conversation

@LuLaValva
Copy link
Member

Use a <define> pattern for switching between tags, instead of a dynamic tag with a <const>

Copilot AI review requested due to automatic review settings January 26, 2026 19:10
@changeset-bot
Copy link

changeset-bot bot commented Jan 26, 2026

🦋 Changeset detected

Latest commit: 3a6b969

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@evo-web/marko Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the evo-card component to use a <define> pattern instead of a dynamic tag with <const> for switching between different HTML elements (span, anchor, button). This improves code readability and maintainability by making the conditional tag selection more explicit and declarative.

Changes:

  • Replaced the IIFE-based <const> block that returned tag names and attributes with a <define> block
  • Moved conditional logic for tag selection into explicit <if>/<else> blocks within the <define> component
  • Simplified attribute spreading by directly applying them in each conditional branch

@ianmcburnie
Copy link
Contributor

Is this a pattern we'd want to apply to all components when tag switching occurs? If so should we document it in a style guide or somewhere?

@LuLaValva
Copy link
Member Author

Good idea @ianmcburnie! I don't think it makes sense to put in a style guide for this repo, but it's a cool thing to put in some kind of "recommended patterns" doc on the Marko site

@LuLaValva LuLaValva merged commit cc5f867 into main Feb 5, 2026
3 checks passed
@LuLaValva LuLaValva deleted the evo-card-refactor branch February 5, 2026 19:28
@github-actions github-actions bot mentioned this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants